home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / csim / source.lha / source / C++SIM / Element.cc < prev    next >
C/C++ Source or Header  |  1993-06-14  |  738b  |  56 lines

  1. /*
  2.  * Copyright (C) 1993
  3.  *
  4.  * Department of Computing Science,
  5.  * The University,
  6.  * Newcastle upon Tyne,
  7.  * UK.
  8.  */
  9.  
  10.  
  11. #ifndef ELEMENT_H_
  12. #include "Element.h"
  13. #endif
  14.  
  15. #ifndef SET_H_
  16. #include "Set.h"
  17. #endif
  18.  
  19.  
  20. Element::Element ()
  21.                   : value(0)
  22. {
  23. }
  24.  
  25. Element::Element (long x)
  26.                         : value(x)
  27. {
  28. }
  29.  
  30. Element::~Element ()
  31. {
  32. }
  33.  
  34. boolean Element::Belongs (Set* toCheck) const
  35. {
  36.     boolean found = false;
  37.     Element* temp = (Element*) toCheck->First();
  38.     
  39.     while ((temp) && (!found))
  40.     {
  41.     if (temp->GetValue() == value)
  42.         found = true;
  43.     else
  44.         temp = (Element*) temp->Suc();
  45.     }
  46.     
  47.     return found;
  48. }
  49.  
  50.  
  51. #ifdef NO_INLINES
  52. #  define ELEMENT_CC_
  53. #  include "Element.n"
  54. #  undef ELEMENT_CC_
  55. #endif
  56.